package com.bright.cwduijie.duijie.repository;

import com.bright.cwduijie.duijie.pojo.po.Contract;
import com.bright.cwduijie.duijie.pojo.po.DayBooks;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ContractRepository extends JpaRepository<Contract, Integer>, JpaSpecificationExecutor<Contract> {

    @Query("select TYSHXYDM from Contract where sjjhbz=:sjjhbz group by TYSHXYDM")
    List<String> getDistinctTYSHXYDMBySjjhbz(@Param("sjjhbz") int sjjhbz);

    @Query("from Contract where sjjhbz=:sjjhbz and TYSHXYDM=:tyshxydm and opType=:opType")
    List<Contract> getAllByTYSHXYDMAndSjjhbzAndOpType(@Param("tyshxydm") String tyshxydm, @Param("sjjhbz") int sjjhbz, @Param("opType") int opType);

}